/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UIServer;

import msnserver.OListaServer;
import java.util.List;
import javax.swing.DefaultListModel;
import msncommonsc.GuardarC;

/**
 *
 * @author Martin
 */
public class ListaServer extends DefaultListModel implements OListaServer {

    public ListaServer() {
        super();
    }

    public void notificarAccion(String nombre, String accion) {
        try {
            String fecha = GuardarC.getInstance().darFecha();
            String hora = GuardarC.getInstance().darHora();
            String text = fecha + "-" + hora + "-" + nombre + "-->" + accion;
            super.addElement(text);
        } catch (Exception e) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

    public void listarLog() {
        try {
            List<String> list = GuardarC.getInstance().leerLog("Log.txt");
            for (String linea : list) {
                super.addElement(linea);
            }
        } catch (Exception e) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }
}
